﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="产品判定入库.aspx.cs" Inherits="syc.Fc.产品判定入库" %>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server" onsubmit="return checkinput();">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    SelectCommand=" SELECT '' as ID,'' as 名称 union all SELECT [ID], [名称] FROM [原料供货单位]"></asp:SqlDataSource>
<asp:DropDownList ID="GongHuo" runat="server" 
    DataSourceID="SqlDataSource1" DataTextField="名称" DataValueField="ID">
</asp:DropDownList>
<asp:Label ID="Label_ID" runat="server" Text="0" Visible="false"></asp:Label>
<asp:HiddenField ID="BeiZhu" runat="server" />
<asp:HiddenField ID="GHList" runat="server" />
<asp:HiddenField ID="LHList" runat="server" />
<asp:HiddenField ID="KHList" runat="server" />
<asp:HiddenField ID="ZLList" runat="server" />
<asp:HiddenField ID="CDList" runat="server" />
<asp:HiddenField ID="ZSList" runat="server" />


<div id="wintop" class="wintop">产品判定入库通知书</div>
<asp:Panel ID="Panel1" runat="server" CssClass="panel">
    <asp:Button ID="Button_Save" runat="server" Text="保 存" CssClass="button" 
        UseSubmitBehavior="False" onclick="Button_Save_Click" />
    <input type="button" value="导出Excel" class="button" onclick="Export();" style="font-weight:normal" />
    <input type="button" value="关 闭" class="button" onclick="parent.swin2_close();" />
</asp:Panel>
<asp:Panel ID="Panel2" runat="server" CssClass="panel">
<span style='margin-left:5px;'></span>生产单位：<asp:DropDownList ID="FenChang" runat="server" Width="100px" Font-Size="12px">
    <asp:ListItem Value="101">一分厂</asp:ListItem>
    
    <asp:ListItem Value="201">二分厂1号线</asp:ListItem>
    <asp:ListItem Value="202">二分厂2号线</asp:ListItem>
    
    <asp:ListItem Value="501">五分厂1号线</asp:ListItem>
    <asp:ListItem Value="502">五分厂2号线</asp:ListItem>
</asp:DropDownList>
<span style='margin-left:5px;'></span>

<asp:SqlDataSource ID="DS_ChanPin" runat="server" 
    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    SelectCommand="SELECT [ID],[品名]+' '+[钢级]+' '+[规格] AS 名称 FROM [产品]">
</asp:SqlDataSource>
产品类别：
<asp:DropDownList ID="ChanPin" runat="server" Width="150px" 
                            Font-Size="12px" DataSourceID="DS_ChanPin" 
                            DataTextField="名称" DataValueField="ID">
</asp:DropDownList>


<span style='margin-left:5px;'></span>日期：<asp:TextBox ID="Date1" runat="server" Width="100px" CssClass="textbox"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" />
<span style='margin-left:5px;'></span>序号：<asp:TextBox ID="XuHao" runat="server" Width="60px" CssClass="textbox"></asp:TextBox>
<span style='margin-left:5px;'></span>库区：<asp:TextBox ID="KuQu" runat="server" Width="60px" CssClass="textbox"></asp:TextBox>
</asp:Panel>


<asp:Panel ID="Panel3" runat="server">
<script>putBillHead();</script>
<style>
#GongHuo{position:absolute; top:295px;left:39px; z-index:4;display:none;}
#Img_PDZ{margin-top:-70px;margin-right:50px;}
td.bb,td.ed,td.gh,td.zl,td.cd,td.zs{border:.5pt solid black;font-size:10pt;text-align:center;height:24px;padding:0px;}
td.ed{background-color:#d2e8ae;}
span.ed{display:inline-block;width:100%;height:100%;line-height:22px;overflow:hidden;background-color:#d2e8ae;}
span.ee{display:inline-block;width:100%;height:100%;line-height:22px;overflow:hidden;}
div.ed{width:100%;height:100%;line-height:15px;overflow:hidden;background-color:#d2e8ae;}
</style>

<table id=mt style='border-collapse: collapse;text-align:center;font-size:11pt; font-family:宋体;' border=0 cellSpacing=0 cellPadding=0>
<tr>
<td colSpan=12 style='font-size:20pt;font-weight:bold;text-align:center;height:60px;'>产品判定入库通知书</td>
</tr>
<tr>
<td height=26 colspan=3 style='text-align:center;' id=box_FenChang>生产单位：<%=this.FenChang.SelectedItem.Text %></td>
<td></td>
<td colspan=3 style='text-align:center;' id=box_Date><%=this.Date1.Text %></td>
<td></td>
<td colspan=4 style='text-align:center;'>编码：SYC/ZJ-JZ-19</td>
</tr>
<tr>
<td class=bb>产品类别</td>
<td class=bb>钢级</td>
<td class=bb colSpan=2>规格mm</td>
<td class=bb colSpan=2>技术条件</td>
<td class=bb>总重量kg</td>
<td class=bb>总长度m</td>
<td class=bb>总支数</td>
<td class=bb>总件数</td>
<td class=bb>入库序号</td>
<td class=bb style='font-size:9pt;'>库区</td>
</tr>
<tr>
<td class=bb id=box_ChanPin></td>
<td class=bb id=box_GangJi></td>
<td class=bb colSpan=2 id=box_GuiGe></td>
<td class=bb colSpan=2>API Spec5CT</td>
<td class=zl x:fmla='=SUM(D6:D35,J6:J35)' id=box_ZZL><%=this.ZZL.ToString("0.0") %></td>
<td class=cd x:fmla='=SUM(E6:E35,K6:K35)' id=box_ZCD><%=this.ZCD.ToString("0.00")%></td>
<td class=bb  x:fmla='=SUM(F6:F35,L6:L35)' id=box_ZZS><%=this.ZZS %></td>
<td class=bb id=box_ZJS><%=this.ZJS %></td>
<td class=bb id=box_XuHao><%=this.XuHao.Text %></td>
<td class=bb id=box_KuQu><%=this.KuQu.Text %></td>
</tr>
<tr>
<td class=bb width=78>原料供货商</td>
<td class=bb width=70>炉号</td>
<td class=bb width=70>捆数编号</td>
<td class=bb width=58>捆重量kg</td>
<td class=bb width=58>捆长度m</td>
<td class=bb width=29 style='font-size:9pt;'>支数</td>
<td class=bb width=78>原料供货商</td>
<td class=bb width=70>炉号</td>
<td class=bb width=70>捆数编号</td>
<td class=bb width=58>捆重量kg</td>
<td class=bb width=58>捆长度m</td>
<td class=bb width=29 style='font-size:9pt;'>支数</td>
</tr>
<tr>
<td class=ed TabIndex=0></td>
<td class=bb><span class=ed></span></td>
<td class=bb><span class=ed></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
<td class=gh TabIndex=0></td>
<td class=bb><span class=ee></span></td>
<td class=bb><span class=ee></span></td>
<td class=zl><span class=ed></span></td>
<td class=cd><span class=ed></span></td>
<td class=zs><span class=ee></span></td>
</tr>
<tr>
<td class=bb style='height:50px;'>备注</td>
<td class=bb colspan=5 style='text-align:left;'><div id=box_BeiZhu class=ed><%=this.BeiZhu.Value %></div></td>
<td class=bb style='height:50px;'>判定结论</td>
<td class=bb colspan=5 style='text-align:left;'><asp:Label ID="Label_JieLun" runat="server" Text=""></asp:Label></td>
</tr>
<tr>
<td height=28></td>
<td align=right>制表人：</td>
<td colSpan=6 style='text-align:left;'><asp:Label ID="Label_ZhiBiao" runat="server" Text=""></asp:Label></td>
<td align=right>判定员：</td>
<td colSpan=3 style='text-align:left;'><asp:Label ID="Label_PanDing" runat="server" Text=""></asp:Label></td>
</tr>
</table>
<asp:Image ID="Img_PDZ" runat="server" ImageUrl="/images/pdz.png" Visible="false" ImageAlign="Right" />
<script>putBillFoot();</script>
</asp:Panel>
</form>

<form id="form2" method="post" action="/PageExport.ashx">
<input type="hidden" name="filename" value="产品判定入库通知书.xls" />
<input type="hidden" name="content" value="" />
</form>
<script>
var notice = "<%=this.Notice %>";//提示信息
    var readonly = <%=this.IsReadonly.ToString().ToLower() %>;
    if (notice != "") {
        parent.showmsgbox(notice);
    }
</script>
<script>
    var mt = document.getElementById("mt");//主表格
    var gh=document.getElementById("GongHuo");
    
    var ghlist;
    var i;
    var cgh=0;//这个变量很重要，标注当前供货商
    function init() {
        document.getElementById("FenChang").onchange = function() {
            document.getElementById("box_FenChang").innerHTML = "生产单位：" + this.options[this.selectedIndex].text;
        };
        document.getElementById("ChanPin").onchange = function() {
            var t = this.options[this.selectedIndex].text.split(" ");
            document.getElementById("box_ChanPin").innerHTML = t[0];
            document.getElementById("box_GangJi").innerHTML = t[1];
            document.getElementById("box_GuiGe").innerHTML = t[2];
        };
        document.getElementById("ChanPin").onchange();
        document.getElementById("Date1").onchange = function() {
            document.getElementById("box_Date").innerHTML = this.value;
        };

        gh.onchange = function()//供货商改变
        {
            if (cgh == 0 || gh.value == "")//第一行或者没有选择
            {
                ghlist[cgh] = gh.value;
                mt.rows[(cgh % 30) + 5].cells[Math.floor(cgh / 30) * 6].innerHTML = gh.options[gh.selectedIndex].text;
                return;
            }
            for (i = cgh - 1; i >= 0; i--)//后退扫描是否有必要显示供货商名称
            {
                if (ghlist[i] != gh.value && ghlist[i] != "") {
                    ghlist[cgh] = gh.value;
                    mt.rows[(cgh % 30) + 5].cells[Math.floor(cgh / 30) * 6].innerHTML = gh.options[gh.selectedIndex].text;
                    return;
                }
                else if (ghlist[i] == gh.value) {
                    break;
                }
            }

            ghlist[cgh] = "";
            mt.rows[(cgh % 30) + 5].cells[Math.floor(cgh / 30) * 6].innerHTML = "";
        };

        var spans = document.getElementsByTagName("span");
        if (readonly) {//只读处理
            for (i = 0; i < spans.length; i++) {
                if (spans[i].className == "ed" || spans[i].className == "ee") {
                    spans[i].className = "";
                }
            }
            mt.rows[5].cells[0].className = "bb";
            document.getElementById("Panel2").style.display = "none";
            document.getElementById("box_BeiZhu").className = "";
            
        }
        else {//使之可编辑
            for (i = 0; i < spans.length; i++) {
                if (spans[i].className == "ed" || spans[i].className == "ee") {
                    spans[i].contentEditable = true;
                    spans[i].tabIndex = 1;
                }
            }
            document.getElementById("box_BeiZhu").contentEditable = true;
        }

        ghlist = document.getElementById("GHList").value.split("|");
        var lhlist = document.getElementById("LHList").value.split("|");
        var khlist = document.getElementById("KHList").value.split("|");
        var zllist = document.getElementById("ZLList").value.split("|");
        var cdlist = document.getElementById("CDList").value.split("|");
        var zslist = document.getElementById("ZSList").value.split("|");
        var lh1="";
        for (i = 0; i < 60; i++) {
            if (ghlist[i]) {
                if (ghlist[i] != "") {
                    if (i == 0 || ghlist[i] != ghlist[i - 1]) {
                        gh.value = ghlist[i];
                        mt.rows[(i % 30) + 5].cells[Math.floor(i / 30) * 6].innerHTML=gh.options[gh.selectedIndex].text;
                    }
                }
            }
            else {
                ghlist[i] = "";
            }
            if (lhlist[i]) {
                if (lh1 != lhlist[i]) {
                    lh1 = lhlist[i];
                    findFirst(mt.rows[(i % 30) + 5].cells[Math.floor(i / 30) * 6 + 1], "SPAN").innerHTML = lh1;
                }
            }
            if (khlist[i]) {
                findFirst(mt.rows[(i % 30) + 5].cells[Math.floor(i / 30) * 6 + 2], "SPAN").innerHTML = khlist[i];
            }
            if (zllist[i]) {
                findFirst(mt.rows[(i % 30) + 5].cells[Math.floor(i / 30) * 6 + 3], "SPAN").innerHTML = zllist[i];
            }
            if (cdlist[i]) {
                findFirst(mt.rows[(i % 30) + 5].cells[Math.floor(i / 30) * 6 + 4], "SPAN").innerHTML = cdlist[i];
            }
            if (zslist[i]) {
                findFirst(mt.rows[(i % 30) + 5].cells[Math.floor(i / 30) * 6 + 5], "SPAN").innerHTML = zslist[i];
            }
        }
    }
    init();

    function GetLastPrefix(tag)//自动填写捆号
    {
        var kh;
        if (tag.parentNode.rowIndex > 5) {
            tag = mt.rows[tag.parentNode.rowIndex - 1].cells[tag.cellIndex];
        }
        else if (tag.cellIndex == 8) {
            tag = mt.rows[34].cells[2];
        }
        else {
            return "";
        }
        if (tag.innerText.match(/^[0-9]{4}-[0-9]{4}$/) == null) {
            return GetLastPrefix(tag);
        }
        else {
            return tag.innerText.split("-")[0];
        }
    }

    function KunHaoFill(tag) {
        if (tag.innerText == "") {
            var t;
            if (tag.parentNode.cellIndex == 2 && tag.parentNode.parentNode.rowIndex == 5)//第一列第一行不自动填捆号
            {
                return;
            }
            else if (tag.parentNode.cellIndex == 8 && tag.parentNode.parentNode.rowIndex == 5)//第二列首行参照第一列末行填捆号
            {
                t = mt.rows[34].cells[2].innerText.split("-");
            }
            else {
                t = mt.rows[tag.parentNode.parentNode.rowIndex - 1].cells[tag.parentNode.cellIndex].innerText.split("-"); //参照上一行填捆号
            }
            if (!Number(t[1])) {
                return;
            }
            else {
                t[1] = Number(t[1]) + 1;
                t[1] = "000" + (new String(t[1]));
                t[1] = t[1].substr(t[1].length - 4, 4)
                tag.innerHTML = t[0] + "-" + t[1]; //自动填捆号
            }
        }
    }
    function KunHaoCheck(tag)//检测捆号
    {
        var errmsg = "“捆数编号”录入有误";
        var t = tag.innerText.replace(/(^ +)|( +$)/, "");
        t = t.replace(/[ \.\*\+\/]+/, "-");
        if (t.search(/[^0-9\-]+/) != -1) {
            tag.innerHTML = "";
            return errmsg;
        }
        if (t == "") return "";
        t = t.split("-");
        if (t.length > 2) {
            return errmsg;
        }
        else if (t.length == 1) {
            if (t[0].length > 4) {
                t[1] = t[0].substr(4);
                t[0] = t[0].substr(0, 4);
            }
            else {
                t[1] = t[0];
                t[0] = GetLastPrefix(tag.parentNode);
            }
        }

        if (t[1].length == "" || Number(t[1]) == 0) {
            tag.innerHTML = "";
            return "";
        }
        else if (t[1].length > 4) {
            return errmsg;
        }
        else if (t[1].length < 4) {
            t[1] = ("000" + t[1]).substr(t[1].length - 1);
        }
        if (t[0] == "" || Number(t[0]) == 0) {
            return errmsg + "，请录入捆号前缀";
        }
        else if (t[0].length < 4) {
            t[0] = ("000" + t[0]).substr(t[0].length - 1);
        }
        tag.innerHTML = t[0] + "-" + t[1];
        return "";
    }
    
    //计算合计
    function sum() {
        var zzl = 0;
        var zcd = 0;
        var zzs = 0;
        var zjs = 0;
        var n1, n2, n3, n4;
        for (i = 0; i < 60; i++) {
            n1 = mt.rows[(i % 30) + 5].cells[Math.floor(i / 30) * 6 + 2].innerText;
            n2 = mt.rows[(i % 30) + 5].cells[Math.floor(i / 30) * 6 + 3].innerText;
            n3 = mt.rows[(i % 30) + 5].cells[Math.floor(i / 30) * 6 + 4].innerText;
            n4 = mt.rows[(i % 30) + 5].cells[Math.floor(i / 30) * 6 + 5].innerText;
            if (n1 != "" && n2 != "" && n3 != "" && n3 != "") {
                n2 = Number(n2);
                n3 = Number(n3);
                n4 = Number(n4);
                if (n2 && n3 && n4 && n2 > 0 && n3 > 0 && n4 > 0) {
                    zzl = zzl + n2;
                    zcd = zcd + n3;
                    zzs = zzs + n4;
                    zjs++;
                }
            }
        }
        document.getElementById("box_ZZL").innerHTML = fixFloatZ(zzl, 1);
        document.getElementById("box_ZCD").innerHTML = fixFloatZ(zcd, 2);
        document.getElementById("box_ZZS").innerHTML = zzs;
        document.getElementById("box_ZJS").innerHTML = zjs;
    }
    
    
    //按键处理
    document.onkeydown = function(e) {
        var o;
        if (!e) e = window.event;
        var tag = e.srcElement;
        if (!tag) tag = e.target;
        if (tag.tagName == "INPUT" && tag.className == "textbox" || tag.tagName == "SELECT" || tag.tagName == "SPAN" || tag.tagName == "DIV") {
            if (e.keyCode == 13) {
                if (tag.id == "box_BeiZhu") {
                    return false;
                }
                else if (tag.parentNode.className == "zs")//在支数录入框处回车
                {
                    if (tag.parentNode.parentNode.rowIndex < 34)//最后一行
                    {
                        o = findFirst(mt.rows[tag.parentNode.parentNode.rowIndex + 1].cells[tag.parentNode.cellIndex - 3], "SPAN");
                        KunHaoFill(o);
                        o = findFirst(mt.rows[tag.parentNode.parentNode.rowIndex + 1].cells[tag.parentNode.cellIndex - 2], "SPAN");
                        o.focus();
                        return false;
                    }
                    else {
                        if (tag.parentNode.cellIndex == 5)//第1列末行，掉到第2列首行
                        {
                            o = findFirst(mt.rows[5].cells[8], "SPAN");
                            KunHaoFill(o);
                            o = findFirst(mt.rows[5].cells[9], "SPAN");
                            o.focus();
                            return false;
                        }
                        else//第2列末行,跳到备注
                        {
                            document.getElementById("box_BeiZhu").focus();
                            return false;
                        }
                    }
                }
                else {
                    e.keyCode = 9; //跳到下一格
                }
            }
        }
        else if (e.keyCode == 8) {
            return false;
        }
    }
    
    //编辑前处理
    document.onfocusin = function(e) {
        if (!e) e = window.event;
        var tag = e.srcElement;
        if (!tag) tag = e.target;
        if (tag.tagName == "TD" && (tag.className == "gh" || tag.className == "ed")) //供货商栏获得焦点，显示供货商列表框
        {
            if (!readonly) {
                if (tag.cellIndex == 0) {
                    cgh = tag.parentNode.rowIndex - 5;
                }
                else {
                    cgh = tag.parentNode.rowIndex + 25;
                }
                gh.style.left = (getObjectLeft(tag) + 1) + "px";
                gh.style.top = (getObjectTop(tag) + 1) + "px";
                gh.style.display = "block";
                gh.value = ghlist[cgh];
                gh.focus();
            }
        }
        else if (tag.tagName == "SPAN" && tag.parentNode.className == "zs") //支数录入框获得焦点，自动填写19或7
        {
            if (tag.innerText == "") {
                if (document.getElementById("ChanPin").value == "1" || document.getElementById("ChanPin").value == "3") {
                    tag.innerHTML = "19";
                }
                else {
                    tag.innerHTML = "7";
                }
            }
        }
        else if (tag.tagName == "SPAN" && (tag.parentNode.cellIndex == 2 || tag.parentNode.cellIndex == 8))//捆号录入框获得焦点，自动填写捆号
        {
            KunHaoFill(tag);
        }
    }
    
    //编辑后检测
    document.onfocusout = function(e) {
        if (!e) e = window.event;
        var tag = e.srcElement;
        if (!tag) tag = e.target;

        if (tag.id == "XuHao") {
            document.getElementById("box_XuHao").innerHTML = tag.value;
        }
        else if (tag.id == "KuQu") {
            document.getElementById("box_KuQu").innerHTML = tag.value;
        }
        else if (tag == gh) {
            gh.style.display = "none";
        }
        else if (tag.tagName == "SPAN" && tag.parentNode.tagName == "TD") {
            var cl = false; //录入完一捆信息，切换到其他位置时，检测方才录入的捆信息
            if (document.activeElement.tagName == "SPAN" && document.activeElement.parentNode.tagName == "TD") {
                if (document.activeElement.parentNode.parentNode.rowIndex != tag.parentNode.parentNode.rowIndex) {//换行了
                    cl = true;
                }
                else if (document.activeElement.parentNode.cellIndex < 6 && tag.parentNode.cellIndex >= 6
                    || document.activeElement.parentNode.cellIndex >= 6 && tag.parentNode.cellIndex < 6) {//换列了
                    cl = true;
                }
            }
            else {//切换到其他地方
                cl = true;
            }
            if (cl) {//捆信息不完整就清除
                if (mt.rows[tag.parentNode.parentNode.rowIndex].cells[Math.floor(tag.parentNode.cellIndex / 6) * 6 + 3].innerText == ""
                    || mt.rows[tag.parentNode.parentNode.rowIndex].cells[Math.floor(tag.parentNode.cellIndex / 6) * 6 + 4].innerText == "") {
                    var o = findFirst(mt.rows[tag.parentNode.parentNode.rowIndex].cells[Math.floor(tag.parentNode.cellIndex / 6) * 6 + 2], "SPAN");
                    if (o) o.innerHTML = "";
                    o = findFirst(mt.rows[tag.parentNode.parentNode.rowIndex].cells[Math.floor(tag.parentNode.cellIndex / 6) * 6 + 3], "SPAN");
                    if (o) o.innerHTML = "";
                    o = findFirst(mt.rows[tag.parentNode.parentNode.rowIndex].cells[Math.floor(tag.parentNode.cellIndex / 6) * 6 + 4], "SPAN");
                    if (o) o.innerHTML = "";
                    o = findFirst(mt.rows[tag.parentNode.parentNode.rowIndex].cells[Math.floor(tag.parentNode.cellIndex / 6) * 6 + 5], "SPAN");
                    if (o) o.innerHTML = "";
                }
                sum(); //重新计算合计
            }

            if (tag.parentNode.cellIndex == 0 || tag.parentNode.cellIndex == 6) {

            }
            else if (tag.parentNode.cellIndex == 2 || tag.parentNode.cellIndex == 8) {//修正捆号
                var errmsg = KunHaoCheck(tag);
                if (errmsg == "") {
                    tag.style.color = "";
                }
                else {
                    parent.showmsgbox(errmsg);
                    tag.style.color = "red";
                }
            }
            else if (tag.parentNode.cellIndex == 3 || tag.parentNode.cellIndex == 9) {//检测捆重量
                if ((tag.innerText != "" && !Number(tag.innerText)) || tag.innerText < 0) {
                    parent.showmsgbox("“捆重量”只能录入正数。");
                    tag.style.color = "red";
                }
                else {
                    tag.style.color = "";
                    if (tag.innerHTML != "") {
                        tag.innerHTML = fixFloatZ(tag.innerHTML, 1);
                    }
                }
            }
            else if (tag.parentNode.cellIndex == 4 || tag.parentNode.cellIndex == 10) {//检测捆长度
                if ((tag.innerText != "" && !Number(tag.innerText)) || tag.innerText < 0) {
                    parent.showmsgbox("“捆长度”只能录入正数。");
                    tag.style.color = "red";
                }
                else {
                    tag.style.color = "";
                    if (tag.innerHTML != "") {
                        tag.innerHTML = fixFloatZ(tag.innerHTML, 2);
                    }
                }
            }
            else if (tag.parentNode.cellIndex == 5 || tag.parentNode.cellIndex == 11) {//检测捆支数
                if (tag.innerText.match(/[^0-9]/) || tag.innerText < 0) {
                    parent.showmsgbox("“支数”只能录入正整数。");
                    tag.style.color = "red";
                }
                else {
                    tag.style.color = "";
                }
            }
        }
    }

    //提交前检测
    function checkinput() {
        var o = document.getElementById("XuHao");
        if (o.value == "") {
            parent.showmsgbox("“序号”必须填写。");
            return false;
        }
        else if (o.value.match(/[^0-9]/)) {
            parent.showmsgbox("“序号”只能录入正数。");
            return false;
        }

        var o = document.getElementById("KuQu");
        if (o.value == "") {
            parent.showmsgbox("“库区”必须填写。");
            return false;
        }
        else if (o.value.match(/[^0-9]/) || o.value > 100) {
            parent.showmsgbox("“库区”只能录入 1 ～ 100 的数");
            return false;
        }

        document.getElementById("BeiZhu").value = document.getElementById("box_BeiZhu").innerText;

        var lhlist = new Array();
        var khlist = new Array();
        var zllist = new Array();
        var cdlist = new Array();
        var zslist = new Array();
        for (i = 0; i < 60; i++) {
            lhlist[i] = mt.rows[(i % 30) + 5].cells[Math.floor(i / 30) * 6 + 1].innerText;
            khlist[i] = mt.rows[(i % 30) + 5].cells[Math.floor(i / 30) * 6 + 2].innerText;
            zllist[i] = mt.rows[(i % 30) + 5].cells[Math.floor(i / 30) * 6 + 3].innerText;
            cdlist[i] = mt.rows[(i % 30) + 5].cells[Math.floor(i / 30) * 6 + 4].innerText;
            zslist[i] = mt.rows[(i % 30) + 5].cells[Math.floor(i / 30) * 6 + 5].innerText;
        }

        document.getElementById("GHList").value = ghlist.join("|");
        document.getElementById("LHList").value = lhlist.join("|");
        document.getElementById("KHList").value = khlist.join("|");
        document.getElementById("ZLList").value = zllist.join("|");
        document.getElementById("CDList").value = cdlist.join("|");
        document.getElementById("ZSList").value = zslist.join("|");
        return true;
    }


    //导出Excel
    function Export() {
        var code = document.getElementById("mt").outerHTML;
        form2.content.value =
"<html xmlns:o='urn:schemas-microsoft-com:office:office'\nxmlns:x='urn:schemas-microsoft-com:office:excel'\nxmlns='http://www.w3.org/TR/REC-html40'>\n<head>\n<meta http-equiv=Content-Type content='text/html; charset=utf-8'>\n<style>\n<!--table\n@page\n{mso-header-data:;\nmso-footer-data:;\nmargin:.79in .12in .59in .12in;\nmso-header-margin:.51in;\nmso-footer-margin:.51in;\nmso-horizontal-page-align:center;}\ntd{mso-number-format:'\@';}\ntd.ed,td.gh,td.bb{border:.5pt solid black;font-size:10pt;text-align:center;height:24px;padding:0px;}\ntd.zl{border:.5pt solid black;font-size:10pt;text-align:center;height:24px;padding:0px;mso-number-format:'0\.0_ '}\ntd.cd{border:.5pt solid black;font-size:10pt;text-align:center;height:24px;padding:0px;mso-number-format:'0\.00_ '}\ntd.zs{border:.5pt solid black;font-size:10pt;text-align:center;height:24px;padding:0px;mso-number-format:General}\n-->\n</style>\n<!--[if gte mso 9]><xml>\n<x:ExcelWorkbook>\n<x:ExcelWorksheets>\n<x:ExcelWorksheet>\n<x:Name>产品判定入库通知书</x:Name>\n<x:WorksheetOptions>\n<x:DefaultRowHeight>285</x:DefaultRowHeight>\n<x:Print>\n<x:ValidPrinterInfo/>\n<x:Scale>100</x:Scale>\n<x:PaperSizeIndex>9</x:PaperSizeIndex>\n<x:HorizontalResolution>200</x:HorizontalResolution>\n<x:VerticalResolution>200</x:VerticalResolution>\n</x:Print>\n<x:Selected/>\n<x:Panes>\n<x:Pane>\n<x:Number>3</x:Number>\n<x:ActiveRow>5</x:ActiveRow>\n<x:ActiveCol>0</x:ActiveCol>\n</x:Pane>\n</x:Panes>\n</x:WorksheetOptions>\n</x:ExcelWorksheet>\n</x:ExcelWorkbook>\n</xml><![endif]-->\n</head>\n<body>"
        + code + "</body></html>";
        form2.submit();
    }
</script>

</body>
</html>